if(!localStorage.getItem('big-event-token')) {
    location.href='/zj的登入界面.html'
}
// 退出功能
$('#logout').on('click',function() {
    console.log(111);
    layer.confirm("确认退出吗？", { icon: 3, title: "提示" }, () => {
        localStorage.removeItem('big-event-token')
        location.href='/zj的登入页面.html'
    })
})
// 获取个人信息
async function getUserInfoFn() {
    let res =await reqGetUserInfo()
    console.log(res.data.status);
    let {data:{username, nickname,user_pic}}=res.data
    console.log(username, nickname,user_pic);
    if(user_pic===null) {
        $('.avatar').css('display','inline-block').text(username[0].toUpperCase())
    } else {
$('.userinfo img').css('display','inline-block').attr('src',user_pic)
    }
    if(nickname==='') {
        nickname=username
    }
    $('.username').text(nickname)
}
getUserInfoFn()